<?php
define('DB_DSN','mysql:dbname=CRM;charset=utf8');
define('DB_NAME','root');
define('DB_PASSWORD','');

function select($sql,$data=NULL){
	$pdo = new PDO (DB_DSN,DB_NAME,DB_PASSWORD);
	$s = $pdo->prepare ($sql);
	$s->execute ($data);
	return $s->fetch( PDO::FETCH_NAMED );
}
function selectAll($sql,$data=NULL){
	$pdo = new PDO (DB_DSN,DB_NAME,DB_PASSWORD);
	$s = $pdo->prepare ($sql);
	$s->execute ($data);
	return  $s->fetchAll ( PDO::FETCH_NAMED );
}
function insert($sql,$data=NULL){
	$pdo = new PDO (DB_DSN,DB_NAME,DB_PASSWORD);
	$s = $pdo->prepare ($sql);
	$s->execute ($data);
}
function del($sql,$data=NULL){
	$pdo = new PDO (DB_DSN,DB_NAME,DB_PASSWORD);
	$s = $pdo->prepare ($sql);
	$s->execute ($data);
}
function update($sql,$data=NULL){
	$pdo = new PDO (DB_DSN,DB_NAME,DB_PASSWORD);
	$s = $pdo->prepare ($sql);
	$s->execute ($data);
}
